package com.yzd.learnjava.io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;

import com.yzd.learnjava.util.Print;

public class BasicFileOutput {
	static String file = "D:\\src\\git\\java\\javalearn\\src\\com\\yzd\\learnjava\\io\\BasicFileOutput.java";
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new StringReader(BufferedInputFile.read(file)));
		
		PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("BasicFileOutput.out")));
		int lineCount = 1;
		String s ;
		while((s = reader.readLine()) != null) {
			writer.println(lineCount++ + ":" + s);
		}
		writer.close();
		Print.print(BufferedInputFile.read("BasicFileOutput.out"));
	}
}
